package xing.design.pattern.behavioral.Memento.sample3_andCommandPattern.editor.command.edit;

import xing.design.pattern.behavioral.Memento.sample3_andCommandPattern.editor.Editor;

/**
 * @author xing
 * @date 2023/2/10 15:00:46
 */
public class AddStringCommand extends EditCommand {
    private String addContent;

    public AddStringCommand(String addContent) {
        this.addContent = addContent;
    }

    @Override
    public void doExecute(Editor editor) {
        String content = editor.getContent();
        editor.setContent(content + addContent);
    }

    @Override
    public String getName() {
        return "add";
    }
}
